import {
  Component, ElementRef, output,
  ViewChild
} from '@angular/core';
import {
  Button
} from '../../../shared/button/button';
import {
  Control
} from '../../../shared/control/control';
import {FormsModule} from '@angular/forms';

@Component({
  selector: 'app-new-ticket',
  imports: [Button, Control, FormsModule],
  templateUrl: './new-ticket.html',
  styleUrl: './new-ticket.css'
})
export class NewTicket {
  @ViewChild('form') form?:ElementRef<HTMLFormElement>;

    add = output<{title:string,text:string}>();

  onSubmit(title:string,ticketText:string){
    this.add.emit({title:title,text:ticketText});
    this.form?.nativeElement.reset();
  }
}
